<div class="comments">
    <header>
        <div class="pull-right"><a href="#commentReplyForm" class="btn btn-primary"> 发表评论</a></div>
        <h3>所有评论</h3>
    </header>
    <section class="comments-list">
        <!--一级评论  -->
        {foreach name="comment_list" item="comment"}
        <div class="comment">
            <a href="javascript:void(0)" class="avatar">
                    <img src="{$comment.avatar}" alt="{$comment.nickname}">
                </a>
            <div class="content">
                <div class="pull-right text-muted">{$comment.create_time}</div>
                <div><a href="javascript:void(0)"><span class="commenter">{$comment.nickname}</span></a></div>
                <div class="text">{$comment.content}</div>
                {neq name="comment.uid" value="$Think.session.user.id"}
                <div class="actions">
                    <a href="#commentReplyForm" onclick="commentReply('{$comment.id}','{$comment.nickname}')">回复</a>
                </div>
                {/neq}
            </div>
            <div class="comments-list">
                <!--二级评论  -->
                {foreach name="comment.children" item="child"}
                <div class="comment">
                    <a href="javascript:void(0)" class="avatar">
                                <img src="{$child.avatar}" alt="{$child.nickname}">
                            </a>
                    <div class="content">
                        <div class="pull-right text-muted">{$child.create_time}</div>
                        <div><a href="javascript:void(0)"><span class="commenter">{$child.nickname}</span></a> <span class="text-muted">回复</span>
                            <a href="javascript:void(0)"><span class="commented">{$comment.nickname}</span></a>
                        </div>
                        <div class="text">{$child.content}</div>
                        {neq name="child.uid" value="$Think.session.user.id"}
                        <div class="actions">
                            <a href="#commentReplyForm" onclick="commentReply('{$child.id}','{$child.nickname}')">回复</a>
                        </div>
                        {/neq}
                    </div>
                    <div class="comments-list">
                        <!--三级评论  -->
                        {foreach name="child.children" item="grandson"}
                        <div class="comment">
                            <a href="javascript:void(0)" class="avatar">
                                            <img src="{$grandson.avatar}" alt="{$grandson.nickname}">
                                        </a>
                            <div class="content">
                                <div class="pull-right text-muted">{$grandson.create_time}</div>
                                <div><a href="javascript:void(0)"><span class="commenter">{$grandson.nickname}</span></a>
                                    <span class="text-muted">回复</span> <a href="javascript:void(0)"><span class="commented">{$child.nickname}</span></a></div>
                                <div class="text">{$grandson.content}</div>
                            </div>
                        </div>
                        {/foreach}
                    </div>
                </div>
                {/foreach}
            </div>
        </div>
        {/foreach}
    </section>
    {empty name="Think.session.user"}
    <footer>
        <div class="reply-form" id="commentReplyForm">
            <a href="javascript:void(0)" class="avatar"><img src="__UPLOAD__/default_avatar.png" alt=""></a>
            <form class="form">
                <div class="form-group">
                    <textarea class="form-control new-comment-text" name="content" rows="2" placeholder="撰写评论..."></textarea>
                </div>
                <div class="form-group comment-user">
                    <div class="row">
                        <div class="col-sm-2">
                            <a href="{:url('index/action/login')}" class="btn btn-block btn-outline btn-primary">登录后评论</a>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </footer>
    {else/}
    <footer>
        <div class="reply-form" id="commentReplyForm">
            <a href="javascript:void(0)" class="avatar"><img src="{$Think.session.user.avatar|default='__UPLOAD__/default_avatar.png'}" alt="{$Think.session.user.nickname}"></a>
            <form class="form" id="commentForm">
                <div class="form-group">
                    <input type="hidden" name="uid" value="{$Think.session.user.id}">
                    <input type="hidden" name="parent_id" value="0">
                    <input type="hidden" name="aid" value="{$article.id}">
                    <textarea class="form-control new-comment-text" name="content" id="comment" rows="2" placeholder="撰写评论..."></textarea>
                </div>
                <div class="form-group comment-user">
                    <div class="row">
                        <div class="col-sm-8">
                            <div class="form-group">
                                <input type="email" name="email" class="form-control" id="email" placeholder="输入电子邮件（不会在评论显示）">
                            </div>
                        </div>
                        <div class="col-sm-2">
                            <button type="submit" class="btn btn-block btn-outline btn-primary">发表</button>
                        </div>
                        <div class="col-sm-2">
                            <button type="button" onclick="cancelReply()" class="btn btn-block btn-outline btn-primary">取消</button>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </footer>
    {/empty}
</div>